home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Collection of Tools & Utilities
/
Collection of Tools and Utilities.iso
/
network
/
exp16116.zip
/
EXP16.ASM
< prev
next >
Wrap
Assembly Source File
|
1994-05-20
|
64KB
|
2,958 lines
version equ 6
DEBUG equ 0
;History:1985,1
; Copyright 1991, 1992, 1993 Russell Nelson
; This program is free software; you can redistribute it and/or modify
; it under the terms of the GNU General Public License as published by
; the Free Software Foundation, version 1.
;
; This program is distributed in the hope that it will be useful,
; but WITHOUT ANY WARRANTY; without even the implied warranty of
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
; GNU General Public License for more details.
;
; You should have received a copy of the GNU General Public License
; along with this program; if not, write to the Free Software
; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
include defs.asm
code segment word public
assume cs:code, ds:code
;
; Waits for SCB command unit to become idle
;
; MUST NOT TRASH CX OR THE ISSUE_COMMAND PROCEDURE WILL FAIL
;cmd_clear exits with cy if the command didn't become idle in one millisecond.
cmd_clear macro
local exit
lea dx, [bp].@SCB_CMD ;BP -> I/O Base
in ax, dx ;Read SCB command
or ax, ax ;Wait for command accepted
jz exit
call cmd_wait
exit:
endm
;
; Drives channel attention to the 586. We don't care whats in AX, the write
; will cause the ASIC to drive CA to the 586.
;
issue_ca MACRO
lea dx, [bp].@CA_Ctrl
out dx, al
endm
;
;
; Enable and disable exp16s interrupts.
;
enable_board_ints macro
lea dx, [bp].@Sel_IRQ
mov al, encoded_int_no
or al, 08h
out dx, al
endm
disable_board_ints macro
lea dx, [bp].@Sel_IRQ
mov al, encoded_int_no
out dx, al
endm
RxBufferSize equ 1518+14+18 ;Max Rx packet+MAC header+
; 18 (alignment)
TxBufferSize equ 1518+14+20 ;Max Tx packet+MAC header+
; 20 (alignment)
include exp16.inc
_64K_not_32K db 0 ;<>0 if we have 64K of memory.
_16_not_8_bit_slot db 0 ;<>0 if we're in a 16-bit slot.
;possible values for connection_type:
CONN_BNC equ 0
CONN_AUI equ 1
CONN_TPE equ 2
CONN_AUTO equ 3
connection_type db ?
;Memory Sizes
mem_size_address equ 00H
_32K equ 00000h
_64K equ 00001h
CONNECTION_ADDRESS equ 00H
CONNECTION_FIELD equ 0001000000000000B
AUTO_CON_ADDRESS EQU 01H
AUTO_CON_MASK EQU 10000000B
TPE_address equ 05H
TPE_type_field equ 0000000000000001B
int_num_address equ 00H
int_num_field equ 1110000000000000B
int_field_shift equ 13
EE_ETHERNET_ADD_LOW equ 2
EE_ETHERNET_ADD_MID equ 3
EE_ETHERNET_ADD_HIGH equ 4
EE_INT equ 0
EE_SHIFT equ 13
; Slot Width
slot_width_mask equ 04h
_16_bit_slot equ 0000h
_8_bit_slot equ 0001h
_16_bit_override_bit equ 08h
;
; EXP16 base port structure
;
@EXP16BasePorts struc
@Data_Reg dw ? ;Data Transfer Register.
@Write_Ptr dw ? ;Write Address Pointer.
@Read_Ptr dw ? ;Read Address Pointer.
@CA_Ctrl db ? ;Channel Attention Control.
@Sel_IRQ db ? ;IRQ Select.
@SMB_Ptr dw ? ;Shadow Memory Bank Pointer.
db ?
@MEM_Ctrl db ?
@MEM_Page_Ctrl db ?
@Config db ?
@EEPROM_Ctrl db ?
@ID_Port db ?
@EXP16BasePorts ends
ECR1 equ 300eh
@ISR_Ports struc
db 0C008h dup(?)
@SCB_STAT dw ?
@SCB_CMD dw ?
@SCB_CBL dw ?
@SCB_RFA dw ?
; @SCB_CRCERRS dw ?
; @SCB_ALNERRS dw ?
; @SCB_RSCERRS dw ?
; @SCB_OVRNERRS dw ?
@ISR_Ports ends
@memory_page_struc STRUC
DB 4000H DUP (?)
@mem_loc_0 DW ?
@mem_loc_2 DW ?
@mem_loc_4 DW ?
@mem_loc_6 DW ?
@mem_loc_8 DW ?
@mem_loc_10 DW ?
@mem_loc_12 DW ?
@mem_loc_14 DW ?
DB 4000H - 16 DUP (?)
@mem_loc_16 DW ?
@mem_loc_18 DW ?
@mem_loc_20 DW ?
@mem_loc_22 DW ?
@mem_loc_24 DW ?
@mem_loc_26 DW ?
@mem_loc_28 DW ?
@mem_loc_30 DW ?
@memory_page_struc ENDS
;
;
; TData Segment
;
; This segment template represents the 64-KB segment that the 82586
; can address. Shared memory can be either 32K or 64K for the EXP16.
; All structures must be quad-word aligned.
;
; Offset Type of Block Block Size Cnt
; ------ ------------- ---------- ---
; 0000h ISCP 8 1
; 0008h SCB 16 1
; 0020h CommandBlock 104 1
; 00E0h SendBlock(s) 1568 variable
; ????h ReceiveBlock(s) 1568 variable
; FFF6h SCP 10 1
;
TData_64 segment at 0
ISCP ISysConfigPtr <>
SCB SystemControlBlock <>
ORG 20H
CB CommandBlock <>
Send_Blocks DB SIZE SendBlock * Number_of_Tx_Buffers dup (?)
Receive_Blocks LABEL WORD
ORG (0FFFFh - SIZE SCPS + 1) AND 0FFE0H
SCP LABEL BYTE
ORG 0FFFFh - SIZE SCPS + 1
THeapTop LABEL BYTE ;Top of available memory
end_of_send_blocks = 20h + SIZE CommandBlock + (Number_of_Tx_Buffers * SIZE SendBlock)
num_rx_buf_32k = (07FFFh - SIZE SCPS + 1 - end_of_send_blocks) / (SIZE ReceiveBlock)
num_rx_buf_64k = (0FFFFh - SIZE SCPS + 1 - end_of_send_blocks) / (SIZE ReceiveBlock)
TData_64 ENDS
public int_no
int_no db 3,0,0,0 ;must be four bytes long for get_number.
io_addr dw -1,-1 ; I/O address for card
encoded_int_no db ? ;encoded for exp16.
public driver_class, driver_type, driver_name, driver_function, parameter_list
driver_class db BLUEBOOK, IEEE8023, 0 ;from the packet spec
driver_type db 91 ;from the packet spec
driver_name db 'EtherExpress16',0 ;name of the driver.
driver_function db 2 + 16 + 8 ;8 = error in DH, 16 = has TDR function.
parameter_list label byte
db 1 ;major rev of packet driver
db 9 ;minor rev of packet driver
db 14 ;length of parameter list
db EADDR_LEN ;length of MAC-layer address
dw GIANT ;MTU, including MAC headers
dw MAX_MULTICAST * EADDR_LEN ;buffer size of multicast addrs
dw 0 ;(# of back-to-back MTU rcvs) - 1
dw 0 ;(# of successive xmits) - 1
int_num dw 0 ;Interrupt # to hook for post-EOI
;processing, 0 == none,
save_err db 0 ;error bits on promiscuous recieve
pro0 db 0
pro1 db 0
BART_Board_ID EQU 0BABAH
BUD_board_ID EQU 0BABBH
mca_hp_board_ID EQU 0BABCH
board_id dw ?
public rcv_modes
rcv_modes dw 7 ;number of receive modes in our table.
dw 0 ;There is no mode zero
dw 0
dw rcv_mode_2
dw rcv_mode_3
dw rcv_mode_4 ;haven't set up perfect filtering yet.
dw 0
dw rcv_mode_6
;
; 82586 Configuration Parameters
;
config_params LABEL WORD
num_config_params LABEL BYTE ;12 BYTEs
DB 0CH
fifo_limit LABEL BYTE
DB 14
srdy LABEL BYTE ;srdy = 1
save_bad_frame LABEL BYTE ;do not save bad frame
DB 40H
address_length LABEL BYTE ;6 BYTEs
auto_insert_address LABEL BYTE ;auto insert off (1)
preamble_length LABEL BYTE ;2 BYTEs
internal_loopback LABEL BYTE ;0 = OFF 1 = ON
external_loopback LABEL BYTE ;0 = OFF 1 = ON
DB 2EH ;26h in IPXWS
linear_priority LABEL BYTE ;default is 0
accel_contention_resolution LABEL BYTE ;default is 0
exp_backoff_method LABEL BYTE ;0 = 802.3 1 = Alternate
DB 00H
interframe_spacing LABEL BYTE ;default is 60H (96 bits)
DB 60H
slot_time_low LABEL BYTE ;0
DB 00H
slot_time_high LABEL BYTE ;2
retry_num LABEL BYTE ;15
DB 0F2H
promiscuous_mode LABEL BYTE ;0 = OFF 1 = ON
broadcast_disable LABEL BYTE ;0 = OFF 1 = ON
encode_decode LABEL BYTE ;0 = NRZ 1 = MANCHESTER
transmit_on_no_carrier LABEL BYTE ;0 = STOP 1 = CONTINUE
no_crc_insertion LABEL BYTE ;0 = OFF 1 = ON
crc_type LABEL BYTE ;0 = 32 bit autodin II
;1 = 16 bit CCITT
bit_stuffing LABEL BYTE ;0 = 802.3 1 = HDLC
padding LABEL BYTE ;0 = OFF 1 = ON
DB 00H
carrier_sense_filter LABEL BYTE ;0 = OFF 1 = 0N
carrier_sense_source LABEL BYTE ;0 = external 1 = internal
collision_detect_filter LABEL BYTE ;default = 0
collision_detect_source LABEL BYTE ;0 = external 1 = internal
DB 00H
min_frame_length LABEL BYTE ;60 BYTEs
DB 60
DB 00H ;undefined
RxBufferCount dw ?
TxBufferCount dw ?
Receive_Head DW ?
Receive_Tail DW ?
HEADER_LEN equ EADDR_LEN + EADDR_LEN + MAX_P_LEN
even
our_type db HEADER_LEN dup(?)
extrn is_186: byte ;=0 if 808[68], =1 if 80[123]86.
extrn sys_features: byte
include io16.asm
public bad_command_intercept
bad_command_intercept:
;called with ah=command, unknown to the skeleton.
;exit with nc if okay, cy, dh=error if not.
c